package com.servicesystem.demo.utils;

import com.alibaba.fastjson.JSONObject;

/**
 * @ClassName ErrorResponse
 * @Description TODO
 * @Author Mike
 * @Date 2019/6/18 15:39
 * @Version 1.0
 */
public enum ErrorResponse {
    NO_SERVICE("7001","没有找到服务"),
    ERR_JSON("7002","错误的报文格式,基础报文格式应为 {'Head':{'ApiName':''...}} "),
    NO_AUTHORITY("7003","您无权使用此服务"),
    ERR_TOKEN("7004","token 校验失败,请联系管理员"),
    NO_XMLLIST("7005","获取 xml 工作流失败!"),
    FAIL_REGION_INIT("7006","region 服务初始化失败!"),
    FAIL_WORK_INIT("7007","work 服务初始化失败!"),
    ;

    private String status;
    private String desc;

    ErrorResponse(String status,String desc){
        this.status = status;
        this.desc = desc;
    }

    public JSONObject getResponse(){
        JSONObject json = new JSONObject();
        JSONObject head = new JSONObject();
        head.put("Status",this.status);
        head.put("Desc",this.desc);
        json.put("Head",head);
        return json;
    }
}
